const orderApi = require('../../api/order.js');

Page({
  data: {
    orderId: null,
    orderDetails: []
  },

  onLoad(options) {
    this.setData({ orderId: options.id });
    this.loadOrderDetails();
  },

  async loadOrderDetails() {
    const { orderId } = this.data;
    try {
      const res = await orderApi.queryDetail(orderId);
      console.log(res)
      const orderDetails = res.data.data || [];
      this.setData({ orderDetails });
    } catch (err) {
      console.error('加载订单商品明细失败', err);
      wx.showToast({ title: '加载失败', icon: 'none' });
    }
  }
});
